<!--
* @description  
* @fileName  1_姓名案例_插值表达式实现
* @author zhoujunlin
* @date 2022-02-13 20:45:08
* @version V1.0.0
!-->
<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>1_姓名案例_插值表达式实现</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <div id="app">
        姓：<input type="text" v-model:value="firstName"> <br><br>
        名：<input type="text" v-model="lastName"> <br><br>
        <!-- 要求截取前三位，还可以在{{}}添加更多需求，但是十分不推荐，应该尽量简洁 -->
        <!-- 全名：<span>{{firstName+'-'+lastName}}</span> -->
        全名：<span>{{firstName.slice(0,3)}}-{{lastName}}</span>
    </div>

    <script>
        Vue.config.productionTip = false
        var vm = new Vue({
            el: '#app',
            data() {
                return {
                    firstName: '张',
                    lastName: '三'
                }
            }
        });

    </script>
</body>

</html>